import { request } from '@/utils'

export function getMomentList(momentDTO) {
  return request({
    url: '/admin/getMomentList',
    method: 'POST',
    data: JSON.stringify(momentDTO),
    headers: {
      'Content-type': 'application/json;charset=utf-8',
    },
  })
}

export function publishMoment(id, isPublished) {
  return request({
    url: '/admin/publishMoment',
    method: 'POST',
    params: {
      id,
      isPublished,
    },
  })
}

export function saveMoment(momentDTO) {
  return request({
    url: '/admin/saveMoment',
    method: 'POST',
    data: JSON.stringify(momentDTO),
    headers: {
      'Content-type': 'application/json;charset=utf-8',
    },
  })
}

export function deleteMoment(id) {
  return request({
    url: '/admin/deleteMoment',
    method: 'POST',
    params: {
      id,
    },
  })
}

export function getMoment(id) {
  return request({
    url: '/admin/getMoment',
    method: 'GET',
    params: {
      id,
    },
  })
}
